//
//  ThemeViewController.m
//  123
//
//  Created by Wang on 14/11/19.
//  Copyright (c) 2014年 Wang. All rights reserved.
//

#import "ThemeViewController.h"
#import "ThemeModel.h"
#import "ThemeCell.h"
#import "ThemeDetail.h"
@interface ThemeViewController ()<UITableViewDataSource, UITableViewDelegate>

@end

@implementation ThemeViewController

- (void)dealloc
{
    [_array release];
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.array = [NSMutableArray array];
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setTitle:@"主题"];
    [self.navigationController.navigationBar setTranslucent:NO];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [self creatTableView];
}

#pragma mark - 创建TableView
- (void)creatTableView
{
    UITableView *tab = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 49) style:UITableViewStylePlain];
    tab.delegate = self;
    tab.dataSource = self;
    [self.view addSubview:tab];
    [tab registerClass:[ThemeCell class] forCellReuseIdentifier:@"cellPool"];
    [tab release];
}

#pragma mark - 有多少个row
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

#pragma mark - row高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 300;
}


#pragma mark - cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ThemeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellPool"];

    return cell;
}


#pragma mark - cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    ThemeDetail *detail = [[[ThemeDetail alloc] init] autorelease];
    [self.navigationController pushViewController:detail animated:YES];
    
    
}





@end
